<table class="table table-border table-bordered table-hover table-bg">
	<thead>
		<tr class="text-c">
			<th width="25"><input type="checkbox" value="" name=""></th>
			<th width="50">房间号</th>
			<th>合同编号</th>
			<th>客人姓名</th>
			<th>联系方式</th>
			<th width="100">物业截止</th>
			<th width="100">房租截止</th>
			<th width="40">水表</th>
			<th width="40">电表</th>
			<!--<th width="40">气表</th>-->
			<th>操作员</th>
			<th width="50">状态</th>
			<th width="50">审查</th>
			<th>验证码</th>
			<th width="70">操作</th>
		</tr>
	</thead>
	<tbody>
		<?php if(is_array($userlist) && count($userlist)){ ?>
		<?php foreach($userlist as $k=>$user){ ?>
		<tr class="text-c">
			<td><input type="checkbox" value="{$user['member_id']}" name=""></td>
			<td>{$user['room_number']}</td>
			<td>{$user['contract']}</td>
			<td>{$user['member_nick']}</td>
			<td>{$user['member_phone']}</td>
			<td><?php echo date('Y-m-d', $user['property_time']); ?></td>
			<td><?php echo date('Y-m-d', $user['leaving_time']); ?></td>
			<td>{$user['eqment_1']}</td>
			<td>{$user['eqment_2']}</td>
			<!--<td>{$user['eqment_3']}</td>-->
			<td>{$user['nickname']}</td>
			<td>
				<span class="select-box radius" style="width: 80px">
				  	<select class="select mstatus" size="1" user_id="{$user['member_id']}">
					  	<option value="1" <?php echo $user['visible'] == 1 ? 'selected' : ''; ?>>租用</option>
					  	<option value="0" <?php echo $user['visible'] == 0 ? 'selected' : ''; ?>>失效</option>
					  	<option value="-1" <?php echo $user['visible'] == -1 ? 'selected' : ''; ?>>未激活</option>
				  	</select>
				</span>		
			</td>
			<td>
				<span class="select-box radius" style="width: 70px">
				  	<select class="select review" size="1" user_id="{$user['member_id']}">
					  	<option value="1" <?php echo $user['is_review'] == 1 ? 'selected' : ''; ?>>已审</option>
					  	<option value="0" <?php echo $user['is_review'] == 0 ? 'selected' : ''; ?>>未审</option>
				  	</select>
				</span>		
			</td>
			<td>{$user['code']}</td>
			<td>
				<?php if(!empty($user['images'])){ ?>
				<a href="javascript:void(0);" title="图集" onclick="admin_role_edit('查看图集','thumb.html?mid={$user['member_id']}', 1,'700', '500');" style="text-decoration:none"><i class="Hui-iconfont">&#xe613;</i></a>&nbsp;&nbsp;
				<?php } ?>
				<a href="javascript:void(0);" title="编辑" onclick="admin_role_edit('编辑用户信息','add.html?member_id={$user['member_id']}', 1,'1020', '600');" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>&nbsp;&nbsp;
				<a href="javascript:void(0);" title="发送验证码" class="send" user_id="{$user['member_id']}" style="text-decoration:none"><i class="Hui-iconfont">&#xe603;</i></a>
			</td>
		</tr>
		<?php } }else{ ?>
		<tr class="text-c">
			<td colspan="19" >暂无数据...</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<!--page-->
<include file="Common/page" />
<script>
	$(document).ready(function(){
		$(".mstatus").on('change', function(){
			var obj = $(this);
			var	user_id = obj.attr('user_id');
			var	status = $(this).val();
			
			var load = layer.load(2);
			$.post("remove.html",{user_id: user_id, status: status, type: 0}, function(data){
				layer.close(load);
				if(data/1 == 1){
					layer.msg('设置成功', {icon:1, time: 2000});
				}else if(data/1 == 2){
					layer.msg('未到激活时间', {icon:5, time: 2000}, function(){
						obj.find("option[value='"+ status +"']").attr("selected",true);
					});
				}else{
					layer.msg('设置失败', {icon:2, time: 2000});
				}
			});
		});

		$(".review").on('change', function(){
			var obj = $(this);
			var	user_id = $(this).attr('user_id');
			var	status = $(this).val();
			var load = layer.load(2);
			$.post("remove.html",{user_id: user_id, status: status, type: 1}, function(data){
				layer.close(load);
				if(data/1 == 1){
					layer.msg('设置成功', {icon:1, time: 2000});
				}else if(data/1 == 2){
					layer.msg('未到激活时间', {icon:5, time: 2000}, function(){
						obj.find("option[value='"+ status +"']").attr("selected",true);
					});
				}else{
					layer.msg('设置失败', {icon:2, time: 2000});
				}
			});
		});

		$("a.send").on('click', function(){
			var obj = $(this);
			var user_id = obj.attr('user_id');
			var load = layer.load(2);
			$.get("send.html",{user_id: user_id}, function(data){
				layer.close(load);
				if(data/1){
					layer.msg('发送成功', {icon: 1, time: 2000});
				}else{
					layer.msg('发送失败', {icon: 2, time: 2000});
				}
			});
		});
		
		/*全选*/
		$("table thead th input:checkbox").on("click" , function(){
			$(this).closest("table").find("tr > td:first-child input:checkbox")
					.prop("checked",$("table thead th input:checkbox")
					.prop("checked"));
	    });
		
		$("#queryCount").html("{$count}");
	});
</script>